package de.hska.artikelverwaltung.ui;

import static de.hska.util.LogUtil.begin;
import static de.hska.util.LogUtil.end;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.richfaces.component.Dropzone;
import org.richfaces.event.DropEvent;
import org.richfaces.event.DropListener;

public class ArtikelAussondernDndBean implements DropListener {
	private static final Log LOG = LogFactory.getLog(ArtikelAussondernDndBean.class);
	private static final boolean DEBUG = LOG.isDebugEnabled();
	private static final boolean TRACE = LOG.isTraceEnabled();
	
	private ArtikelverwaltungUiBean av;
	
	/**
	 */
	public void processDrop(DropEvent dropEvent) {
		if (DEBUG) begin(LOG);
		
		final Object dragValue = dropEvent.getDragValue();
		if (TRACE) LOG.trace(dragValue);
		
		final Dropzone dropzone = (Dropzone) dropEvent.getComponent();
		final Object dropValue = dropzone.getDropValue();
		if (TRACE) LOG.trace(dropValue);
		
		av.updateArtikelAuswahl(dragValue, dropValue);
		if (DEBUG) end(LOG);
	}

	/**
	 */
	public ArtikelverwaltungUiBean getAv() {
		return av;
	}

	/**
	 */
	public void setAv(ArtikelverwaltungUiBean av) {
		this.av = av;
	}
}
